<template>
<div style="border:7px #999 solid;width:20%;height:610px;margin-left:40%;border-radius:40px;">
    <div style="margin-top:40px">{{msg}}</div>
    <div class="c">
        <div class="c1">
            <div class="c2">身高</div>
            <input type="text" v-model="cm" placeholder="请输入身高" class="c3">
            <div class="c4">cm</div>
        </div>

        <div class="c1">
            <div class="c2">体重</div>
            <input type="text" v-model="kg" placeholder="请输入体重" class="c3">
            <div class="c4">kg</div>
        </div>

        <div class="c1">
            <div class="c2">日期</div>
            <input type="text" v-model="date" placeholder="2019/06/09" class="c3">
            <img src="../assets/4.png" class="c5">
        </div>
    </div>
    <button class="b" @click="store">保存</button>
</div>
</template>

<script>
export default {
    data(){
        return{
            msg:'新增成长记录',
            cm:'',
            kg:'',
            date:''
        }
    },

    methods: {
        store(){
            let that=this
            this.$axios({
                method:'post',
                url:'http://127.0.0.1/12yue/12yuexingmu/laravel/public/api/czjl',
                params:{
                    cm:this.cm,
                    kg:this.kg,
                    date:this.date
                }
            })
            .then(function(res){
                console.log(res.data)
                alert(res.data.msg)
                if(res.data.code==0)
                {
                    that.$router.push({
                        path:'/show'
                    })
                }
            })
        }
    },
}
</script>

<style lang="">
.c5{
  float:left;
  width:18px;
  height:18px;
  margin-top:17px;
  margin-left:60px;
}
.c4{
  float:left;
  width:18px;
  height:18px;
  margin-top:17px;
  margin-left:60px;
}
.c2{
  float: left;
  font-size:12px;
  width:20%;
  height:20px;
  margin-top:17px;
  font-weight:600;
  color:#aaa;
}
.c3{
  float: left;
  font-size:12px;
  width:30%;
  height:15px;
  margin-top:17px;
  margin-left:40px;
  border:1px white solid;
}
.c1{
  width:100%;
  height:45px;
  border-bottom:1px #eee solid;
  float: left;
}
.c{
  margin-left:7%;
  margin-top:30px;
  width:86%;
  height:380px;
}
.b{
    width:80%;
    height:35px;
    background-color:red;
    border:1px red solid;
    border-radius:20px;
    color:white;
    font-weight:600;
}
</style>